package com.diy.sigmund.diyuser.controller;

import com.diy.sigmund.diycommon.entity.ResultMsg;
import com.diy.sigmund.diyuser.entity.dto.UserBaseDTO;
import com.diy.sigmund.diyuser.service.UserBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户基础信息控制类
 *
 * @author ylm-sigmund
 * @since 2021/8/30 17:06
 */
@RestController
@RequestMapping("/user/userBase")
public class UserBaseController {

    @Autowired
    private UserBaseService userBaseService;

    /**
     * @api {POST} /user/userBase/update update
     * @apiVersion 1.0.0
     * @apiGroup UserBaseController
     * @apiName update
     * @apiDescription 更新用户基础信息，只填修改字段即可
     * @apiParam (请求体) {String} userId 用户id
     * @apiParam (请求体) {String} userRole 角色 1正常用户 2禁言用户 3虚拟用户 4运营
     * @apiParam (请求体) {String} registerSource 注册来源：1手机号 2邮箱 3用户名 4qq 5微信 6腾讯微博 7新浪微博
     * @apiParam (请求体) {String} userName 用户账号，必须唯一
     * @apiParam (请求体) {String} nickName 用户昵称
     * @apiParam (请求体) {String} gender 用户性别 0-female 1-male
     * @apiParam (请求体) {Number} birthday 用户生日
     * @apiParam (请求体) {String} signature 用户个人签名
     * @apiParam (请求体) {String} phone 手机号码(唯一)
     * @apiParam (请求体) {Number} phoneBindTime 手机号码绑定时间
     * @apiParam (请求体) {String} email 邮箱(唯一)
     * @apiParam (请求体) {Number} emailBindTime 邮箱绑定时间
     * @apiParam (请求体) {String} face 头像
     * @apiParam (请求体) {String} face200 头像 200x200x80
     * @apiParam (请求体) {String} originalFace 原图头像
     * @apiParam (请求体) {Number} createTime 创建时间
     * @apiParam (请求体) {Number} updateTime 更新时间
     * @apiParam (请求体) {String} pushToken 用户设备push_token
     * @apiParamExample 请求体示例
     * {"birthday":3987153303226,"gender":"mQxdReUl","signature":"YA1O","nickName":"E4","originalFace":"9Efh1ke","updateTime":3765765333596,"userName":"cZm7xUV8V2","userId":"WxgVvWZVZ4","pushToken":"cLZCVVeBDi","registerSource":"V0Q0","emailBindTime":4110632508258,"face":"4Q1w6zuP","phone":"pV","createTime":2225453292752,"face200":"1qcZZo","phoneBindTime":2741830965138,"userRole":"IFTRb1Fk","email":"QFZwdV2E"}
     * @apiSuccess (响应结果) {String} code 响应码，200表示成功，其它表示失败
     * @apiSuccess (响应结果) {String} msg 提示信息
     * @apiSuccess (响应结果) {Object} data 响应数据
     * @apiSuccessExample 响应结果示例
     * {"msg":"成功","code":"200","data":{}}
     * @apiErrorExample 失败结果示例
     * {"msg":"访问请求处理失败","code":"99","data":{}}
     * @apiHeader {String} token Users unique accessToken.
     */
    @PostMapping("/update")
    public ResultMsg update(@RequestBody UserBaseDTO dto) {
        return userBaseService.update(dto);
    }
}
